<template>
  <li :class="className" @click="getIndex">
    <img :src="'https://fuss10.elemecdn.com/' + NewUrl" alt="">
    <span class="na">{{typeName}}</span>
    <div class="count">{{count}}</div>
    <van-icon name="arrow" class="right" />
  </li>
</template>

<script>
  export default {
    name: "ListOne",
    data() {
      return {
        NewUrl: String,
      }
    },
    props: {
      imgUrl: {
        type: String,
        default: "",
      },
      typeName: {
        type: String,
        default: "",
      },
      count: {
        type: Number,
        default: 0,
      },
      className: {
        type: String,
        default: "",
      }
    },
    mounted() {
      let str = this.imgUrl;
      if (str.length > 35) {
        this.NewUrl = str.substring(0, 1) + "/" + str.substring(1, 3) + "/" + str.substring(3, 36) + ".jpeg";
      } else {
        this.NewUrl = str.substring(0, 1) + "/" + str.substring(1, 3) + "/" + str.substring(3, 35) + ".png";
      }

    },
    methods: {
      getIndex() {
        return this.$emit('getIndex', {

        })
      }
    },
  }
</script>

<style lang="less">
  li {
    text-align: left;
    padding: 23px 30px;
    position: relative;
    height: 42px;
  }

  li img {
    height: 100%;
    vertical-align: top;
  }

  li .na {
    display: inline-block;
    font-size: 10px;
    margin-left: 20px;
    vertical-align: top;
    margin-top: 5px;
    color: #666;
  }

  li .count {
    padding: 6px;
    top: 0;
    bottom: 0;
    margin: auto;
    display: inline-block;
    height: 28px;
    min-width: 28px;
    text-align: center;
    border-radius: 28px;
    font-size: 12px;
    background-color: #ccc;
    position: absolute;
    right: 65px;
    font-weight: 600;
    color: white;
    vertical-align: middle;
  }

  li .right {
    position: absolute;
    right: 12px;
    color: #ccc;
    font-size: 13px;
    top: 35%;
  }

  .select {
    background-color: #fff;
  }

  .normal {
    background-color: #f5f5f5;
  }
</style>